#ifndef _STRING_H
#define _STRING_H


#ifndef NULL
#define NULL ((void *) 0)
#endif /* NULL */

typedef unsigned int size_t;

/*
 * Funcion: memcpy
 * ---------------
 * Descripcion de la GNU C Library (http://www.gnu.org/software/libc/):
 * The memcpy function copies size bytes from the object beginning at
 * from into the object beginning at to. The behavior of this function is
 * undefined if the two arrays to and from overlap; use memmove instead
 * if overlapping is possible.
 * The value returned by memcpy is the value of to.
 */
void *memcpy(void *to, const void *from, size_t size);

/*
 * Funcion: memset
 * ---------------
 * Descripcion de la GNU C Library (http://www.gnu.org/software/libc/):
 * This function copies the value of c (converted to an unsigned char) into
 * each of the first size bytes of the object beginning at block. It returns
 * the value of block.
 */
void *memset(void *block, int c, size_t size);

/*
 * Funcion: strcpy
 * ---------------
 * Descripcion de la GNU C Library (http://www.gnu.org/software/libc/):
 * This copies characters from the string from (up to and including the
 * terminating null character) into the string to. Like memcpy, this
 * function has undefined results if the strings overlap. The return value
 * is the value of to.
 */
char *strcpy(char *to, const char *from);

/*
 * Funcion: strncpy
 * ----------------
 * Descripcion de la GNU C Library (http://www.gnu.org/software/libc/):
 * This function is similar to strcpy but always copies exactly size
 * characters into to.
 * If the length of from is more than size, then strncpy copies just the
 * first size characters. Note that in this case there is no null terminator
 * written into to.
 */
char *strncpy(char *to, const char *from, size_t size);

/*
 * Funcion: strlen
 * ---------------
 * Descripcion de la GNU C Library (http://www.gnu.org/software/libc/):
 * The strlen function returns the length of the null-terminated string s in
 * bytes. (In other words, it returns the offset of the terminating null
 * character within the array.)
 * When applied to a character array, the strlen function returns the length
 * of the string stored there, not its allocated size.
 */
size_t strlen(const char *s);

/*
 * Funcion: strnlen
 * ----------------
 * The strnlen function returns the length of the string s in bytes if this
 * length is smaller than maxlen bytes. Otherwise it returns maxlen. Therefore
 * this function is equivalent to (strlen (s) < n ? strlen (s) : maxlen) but
 * it is more efficient and works even if the string s is not null-terminated.
 */
size_t strnlen (const char *s, size_t maxlen);

/*
 * Funcion: memcmp
 * ---------------
 * Descripcion de la GNU C Library (http://www.gnu.org/software/libc/):
 * The function memcmp compares the size bytes of memory beginning at a1
 * against the size bytes of memory beginning at a2. The value returned has
 * the same sign as the difference between the first differing pair of bytes
 * (interpreted as unsigned char objects, then promoted to int).
 * If the contents of the two blocks are equal, memcmp returns 0.
 */
int memcmp(const void *a1, const void *a2, size_t size);

/*
 * Funcion: strcmp
 * ---------------
 * Descripcion de la GNU C Library (http://www.gnu.org/software/libc/):
 * The strcmp function compares the string s1 against s2, returning a value
 * that has the same sign as the difference between the first differing pair
 * of characters (interpreted as unsigned char objects, then promoted to int).
 * If the two strings are equal, strcmp returns 0.
 * A consequence of the ordering used by strcmp is that if s1 is an initial
 * substring of s2, then s1 is considered to be "less than" s2.
 * strcmp does not take sorting conventions of the language the strings are
 * written in into account. To get that one has to use strcoll.
 */
int strcmp(const char *s1, const char *s2);

/*
 * Funcion: strncmp
 * ----------------
 * Descripcion de la GNU C Library (http://www.gnu.org/software/libc/):
 * This function is the similar to strcmp, except that no more than size wide
 * characters are compared. In other words, if the two strings are the same
 * in their first size wide characters, the return value is zero.
 */
int strncmp (const char *s1, const char *s2, size_t size);

/*
 * Funcion: invierte
 * ----------------
 * Recibe un string en su primer parametro y lo devuelve invertido en su segundo
 * parametro.
 */
void invierte(char * origen, char * destino, int dim);

#endif /* _STRING_H */

